using System;
using System.Linq.Expressions;
using KamLib;
using KamLib.Linq.Expressions;


namespace Ext.Net.UIS.Script
{


    [TermScript.ScriptTermConstant]
    public class ScriptTerm
    {
        public ScriptTerm(string name)
        {
            if ((name = name.Trim()).no())
                throw new ArgumentException("UIS.ScriptTerm: parameter name can't be empty.");
            Name = name;
        }

        public readonly string Name;

        public static implicit operator ScriptTerm(string name) { return new ScriptTerm(name); }
        public static implicit operator Expression(ScriptTerm term) { return Expression.Constant(term); }
        public static implicit operator ConstantExpression(ScriptTerm term) { return Expression.Constant(term); }

        public override string ToString() { return Name.no() ? base.ToString() : Name; }


        #region Operators

        public static ScriptTerm operator +(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator +(object left, ScriptTerm right) { return right; }
        public static ScriptTerm operator +(ScriptTerm left, string right) { return left; }
        public static ScriptTerm operator +(string left, ScriptTerm right) { return right; }
        public static ScriptTerm operator +(ScriptTerm left, ScriptTerm right) { return right; }

        public static ScriptTerm operator -(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator -(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator *(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator *(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator /(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator /(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator %(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator %(object left, ScriptTerm right) { return right; }


        public static ScriptTerm operator &(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator &(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator |(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator |(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator ^(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator ^(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator !(ScriptTerm left) { return left; }


        public static ScriptTerm operator ==(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator ==(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator !=(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator !=(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator <(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator <(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator <=(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator <=(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator >(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator >(object left, ScriptTerm right) { return right; }

        public static ScriptTerm operator >=(ScriptTerm left, object right) { return left; }
        public static ScriptTerm operator >=(object left, ScriptTerm right) { return right; }

        public static bool operator true(ScriptTerm left) { return false; }
        public static bool operator false(ScriptTerm left) { return false; }

        public static implicit operator bool(ScriptTerm left) { return false; }

        #endregion

        [TermScript.FieldProperty("enabled", "setEnabled")]
        public object Enabled { get; set; }

        [TermScript.FieldProperty("getValue()", "setValue")]
        public object Value { get; set; }








    }
}